<%@page pageEncoding="UTF-8" contentType="text/html;charset=utf-8" errorPage="/error.jsp"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<script>
function jumpPage(pageNo) {
	$("#pageNo").val(pageNo);
	$("#form").submit();
}
</script>
<input type="hidden" name="pageNo" id="pageNo" value="${page.pageNo}"/> 

<ul class="pagination">

<c:set var="offset" value="2"/>
<c:set var="begin" value="${page.pageNo-offset}"/>
<c:set var="end" value="${page.pageNo+offset}"/>
<c:if test="${page.pageNo-offset<=0}">
	<c:set var="end" value="${end+offset-page.pageNo+1}"/>
</c:if>
<c:if test="${end>=page.totalPages}">
	<c:set var="beginOffset" value="${end-page.totalPages}"/>
	<c:set var="begin" value="${begin-beginOffset}"/>
	<c:set var="end" value="${page.totalPages}"/>
</c:if>
<c:if test="${begin<1}">
	<c:set var="begin" value="1"/>
</c:if>

<c:if test="${begin == 1}">
	<li class="prev disabled"><a href="javascript:void(0);">«</a></li>
</c:if>
<c:if test="${begin != 1}">
	<li class="prev"><a href="javascript:jumpPage(1)">«</a></li>
</c:if>

<c:forEach begin="${begin}" end="${end}" var="pno">
	<c:if test="${page.pageNo==pno}"><li class="active"><a href="###">${pno}</a></li></c:if>
	<c:if test="${page.pageNo!=pno}"><li><a href="javascript:jumpPage(${pno})">${pno}</a></li></c:if>
</c:forEach>

<c:if test="${page.pageNo+2 >=page.totalPages }">
	<li class="next disabled"><a href="javascript:void(0);">»</a></li>
</c:if>
<c:if test="${page.pageNo+2 < page.totalPages }">
	<li class="next"><a href="javascript:jumpPage(${page.totalPages})">»</a></li>
</c:if>
<li class="disabled"><span style="cursor: auto;">共<b> ${page.totalCount} </b>条</span></li>
</ul>
 
   	
  